import React from 'react'

type Props = {}

const App = (props: Props) => {

  //排序
  const arr4 = [2, 5, 9, 4, 1];
  console.log("排序",arr4.sort());
  
  //查值
  const cz = [1, 3, 4, 5, 6];
  const max = Math.max(...cz);
  const min = Math.min(...cz);
  console.log("差值",max - min);


  //去重
  const array=new Set([1,1,2,2,3,3,4,4,5,5])
  console.log("去重",array);
  
  
  //封装函数
  type Difference = (a: number, b: number) => number;
  const difference: Difference = function (a, b) {
    return a - b;
  }
  console.log(difference(1,8));
  

  //正确实现reformatNuber函数
  function reformatNuber(a: number, b: number) {
    return a - b;
  }
  console.log(reformatNuber(20,10));
  

  //去重求和
  const arr2 = (a: number[]) => {
    const un = Array.from(new Set(a))
    const sum = un.reduce((w, x) => w + x, 0);
    return sum
  }
  const numbers=[1,1,4,4,6,6,8,8]
  const result = arr2(numbers);
  console.log(result);
  

  //类型
  const brr = (a: string, b: number):boolean => {
    return a.length > b;
  }
  console.log(brr("brr",111));
  
  //继承
  class a1{
    name: string;
    constructor(name: string) {
      this.name = name;
    }
  }

  class a2 extends a1 {
    age: number;
    constructor(title: string, age: number) {
      super(title);
      this.age = age;
    }
  }
  const a3 = new a2('111', 111);
  console.log(a3);

  return (
    <div>App</div>
  )
}

export default App